package myuser;//用户包

import Operation.Borrow;
import Operation.IOperation;
import Operation.Return;
import Operation.Seek;

import java.util.Scanner;

//普通用户类
public class Ordinary extends User{

    public Ordinary(String name) {

        super(name);
        iOperations = new IOperation[]{new Borrow(),new Return(),new Seek()};
    }

    @Override
    public int menu() {
        System.out.println("--------------------------------------------");
        System.out.println("欢迎来到图书管理系统" + "    "  + name);
        System.out.println("---------普通用户界面----------");
        System.out.println("0 --》 借阅图书");
        System.out.println("1 --》 归还图书");
        System.out.println("2 --》 查找图书");
        System.out.println("--------------------------------------------");
        System.out.println("请输入你选择的操作：");
        Scanner scanner = new Scanner(System.in);
        while (true) {
            int choice = scanner.nextInt();
            if (choice < 3) {
                return choice;
            } else {
                System.out.println("输入错误,请重新输入");
            }
        }
    }
}
